<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<jsp:include page="/pages/sysIndex/default.jsp"/>
<div class="main-content">
    <div class="box box-main">
        <div class="box-header">
            <div class="box-title">
                <i class="fa icon-trophy"></i> 用户管理
            </div>
            <div class="box-tools pull-right">
                <a href="#" class="btn btn-default" id="btnSearch" title="查询"><i class="fa fa-filter"></i> 查询</a>
                <sec:authorize
                        access="hasAnyRole({'ROLE_ADMIN_ENTERPRISE_SYSTEM_USER_EDIT'})">
                    <a href="javascript:;" onclick="vLayuiUtil.openLayerWindow('wChangeRole', '<c:url
                            value="/web/admin/systemRole/getRoleBatchEditPart.action"/>','批量调整角色',['50%','80%'])"
                       class="btn btn-default btnTool" title="批量调整角色"><i class="fa fa-plus"></i> 批量调整角色</a>
                </sec:authorize>
            </div>
        </div>
        <div class="box-body">
            <form id="searchForm" action="<c:url value="/web/admin/enterprise/sytemuser/listJson.action"/>"
                  method="post" class="form-inline hide" data-page-no="1" data-page-size="20" data-order-by="">
                <div class="form-group">
                    <label class="control-label">姓名：</label>
                    <div class="control-inline">
                        <input type="text" id="userName" name="userName" value="" maxlength="64"
                               class="form-control width-120">
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label">工号：</label>
                    <div class="control-inline">
                        <input type="text" id="workNo" name="workNo" value="" maxlength="64"
                               class="form-control width-120">
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label">部门：</label>
                    <div class="control-inline">
                        <input type="text" id="organizationName" name="organizationName" value="" maxlength="64"
                               class="form-control width-120">
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label">岗位：</label>
                    <div class="control-inline">
                        <input type="text" id="positionName" name="positionName" value="" maxlength="64"
                               class="form-control width-120">
                    </div>
                </div>

                <div class="form-group">
                    <button type="submit" class="btn btn-primary btn-sm">查询</button>
                    <button type="reset" class="btn btn-default btn-sm">重置</button>
                </div>
            </form>

            <div style="overflow-x:auto">
                <table id="dataGrid"></table>
            </div>
            <div id="dataGridPage"></div>
        </div>
    </div>
</div>
<script>
    $('#dataGrid').dataGrid({
        shrinkToFit:false,
        autoScroll: true,
        searchForm: $("#searchForm"),
        columnModel: [
            <sec:authorize
            access="hasAnyRole({'ROLE_ADMIN_ENTERPRISE_SYSTEM_USER_EDIT'})">
            {
                header: '操作',
                name: 'actions',
                width:200,
                sortable: false,
                title: false,
                formatter: function (val, obj, row, act) {
                    var editUrl = '<c:url value="/web/admin/enterprise/sytemuser/editPage.action?id="/>' + row.id;
                    return '<a href="javascript:;" class="btn btn-default btn-xs btnList" onclick="vLayuiUtil.openLayerMaxWindow(\'wSystemUser\', \'' + editUrl + '\',\'编辑\')"><i class="fa fa-pencil"></i>编辑用户</a>&nbsp;' +
                        '<a class="btn btn-default btn-xs btnList" href="<c:url value="/web/admin/enterprise/sytemuser/resetPassword.action?id="/>' + row.id + '" title="重置密码" data-confirm="确认要重置该用户的密码么？" ><i class="fa fa-edit"></i>重置密码</a>&nbsp;'

                }
            },
            </sec:authorize>
            {header: '编号', name: 'id', index: 'id', width: 50, sortable: false,align: "center"},
            {header: '姓名', name: 'userName', index: 'userName', width: 180,sortable: false, align: "center"},
            {header: '手机号', name: 'userAccount', index: 'userAccount', width: 180, sortable: false,align: "center"},
            {header: '工号', name: 'workNo', index: 'workNo', width: 200,sortable: false, align: "center"},
            {header: '部门', name: 'organization', index: 'organization', width: 180,sortable: false, align: "center"},
            {header: '岗位', name: 'position', index: 'position', width: 180,sortable: false, align: "center"},
            {header: '账号类型', name: 'position', index: 'position', width: 180,sortable: false, align: "center"},
            {header: '角色', name: 'roleName', index: 'roleName', width: 180,sortable: false, align: "center"}
        ],
        // 加载成功后执行事件
        ajaxSuccess: function (data) {

        }
    });
</script>